<?php
/**
 * Created by PhpStorm.
 * User: pc
 * Date: 2018/12/13
 * Time: 15:28
 */

namespace app\admin\model;

use think\Db;
use think\Model;

class User extends Model
{
    /**
     * 获取管理员下的员工
     * @param string $uid
     * @param string $company_id
     * @param string $status
     * @param int $super
     * @return false|\PDOStatement|string|\think\Collection
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function getUser($uid = '', $company_id = '', $status = 1, $super = 2)
    {
        $uid && $where['id'] = ['in', $uid];
        $company_id && $where['company_id'] = $company_id;
        $where['status'] = $status;
        $where['super'] = ['>', $super];
        $where['flag'] = 1;
        $user = Db::name('user')
            ->field('id,username')
            ->where($where)
            ->select();
        return $user;
    }
}